package com.qingzhuge.sys.controller;

import com.qingzhuge.controller.base.AbstractController;
import com.qingzhuge.dto.request.BaseRequestDto;
import com.qingzhuge.dto.response.ResponseBodyDto;
import com.qingzhuge.sys.service.ISysIndexService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : zero.xiao
 * @description : 系统页面视图
 * @date :2018/6/8 0008 下午 14:51
 * @modified :
 */
@Api(tags = "S后台页面")
@RestController
@RequestMapping
public class SysPageController extends AbstractController {
    private ISysIndexService indexService;

    @Autowired(required = false)
    public void setIndexService(ISysIndexService indexService) {
        this.indexService = indexService;
    }

    @GetMapping({"index", "/", "index.html"})
    public ResponseEntity<ResponseBodyDto<Object>> index(@RequestBody(required = false) BaseRequestDto dto) {
        Object bodyDto = null;
        if (null == indexService) {
            log.debug("indexService Can't find implement");
        } else {
            bodyDto = indexService.doIndex(dto);
        }

        return returnSuccess(bodyDto);
    }
}
